﻿using Microsoft.AspNetCore.SignalR;

namespace SmartWMS.Common
{
    public class ChatHub:Hub
    {
        /// <summary>
        /// 接收前端消息，并发送给连接的全部用户
        /// </summary>
        /// <param name="user"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public async Task SendMessage(string msg = "")
        {
            //调用前台方法，发送消息
            await Clients.All.SendAsync("ShowMsg", msg + "--" + new Random().Next(0, 100));
        }
    }
}
